
var _util = require('util/util.js');


var _order_service = {
    getOrder: function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/order_details'),
            method: "GET",
            success: resolve,
            error: reject,
        });
    },
    postOrder: function (orderData,resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/update_order'),
            data: orderData,
            method: "POST",
            success: resolve,
            error: reject,
        });
    },
    getChangeOrder: function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/get_order'),
            method: "GET",
            success: resolve,
            error: reject,
        });
    },
    getPay: function (totalAmount,resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/pay'),
            method: "GET",
            data: {totalAmount},
            success: resolve,
            error: reject,
        });
    },
    getSuccess:  function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/success'),
            method: "GET",
            success: resolve,
            error: reject,
        });
    },
    getMyOrder:  function (orderId,resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/lineItems/'),
            data: {orderId},
            method: "GET",
            success: resolve,
            error: reject,
        });
    },
    getListOrder:  function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/listOrders'),
            method: "GET",
            success: resolve,
            error: reject,
        });
    },
    getCardType:  function (resolve, reject) {
        _util.request({
            url: _util.getServerURL('order/get_cardTpye'),
            method: "GET",
            success: resolve,
            error: reject,
        });
    },
};
module.exports = _order_service;